import { readFileSync } from 'fs'
import { dirname, resolve } from 'path'
import { fileURLToPath } from 'url'

if (typeof __dirname === 'undefined') {
    globalThis.__dirname = dirname(fileURLToPath(import.meta.url))
}
export function loadCorpus(src) {
    const path = resolve(__dirname, '..', src)
    const data = readFileSync(path, { encoding: 'utf-8' }) 
    return JSON.parse(data)
}